<?php

namespace App;

use Exception;
use Illuminate\Support\Facades\DB;

class Util
{
    /**
     * @throws Exception
     */
    public static function mustInTransaction(): void
    {
        if (DB::transactionLevel() === 0) {
            throw new Exception('必须在事务中调用');
        }
    }
}
